home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / RxMUI / Examples / NListtree.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2004-01-31  |  4.0 KB  |  132 lines

  1. /* NListtree example */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init
  7. call CreateApp
  8. call HandleApp
  9. /* never reached */
  10.  
  11. /***********************************************************************/
  12. Init: procedure
  13.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  14.     if AddLibrary("rexxsupport.library","rxmui.library")~=0 then exit
  15.     call RxMUIOpt("DebugMode ShowErr")
  16.     return
  17. /***********************************************************************/
  18. HandleApp: procedure
  19.  
  20.     ctrl_c=2**12
  21.     do forever
  22.  
  23.         call NewHandle("app","h",ctrl_c)
  24.         if and(h.signals,ctrl_c)>0 then exit
  25.         select
  26.             when h.event="QUIT" then exit
  27.             when h.event="DROPEVENT" then call dropFun(h.from,h.to)
  28.             otherwise interpret h.event
  29.         end
  30.     end
  31.     /* never reached */
  32. /***********************************************************************/
  33. CreateApp: procedure
  34.     app.Title="NListtree example"
  35.     app.Version="$VER: NListtree example 2.1 (4.3.2003)"
  36.     app.Copyright="©2000-2003, alfie"
  37.     app.Author="alfie"
  38.     app.Description="NListtree example"
  39.     app.Base="NLISTTREE"
  40.     app.SubWindow="win"
  41.      win.ID="MWIN"
  42.      win.Title="NListtree example"
  43.      win.Contents="mgroup"
  44.  
  45.       mgroup.0="bg"
  46.        bg.Class="group"
  47.        bg.Columns=2
  48.        bg.SameSize=1
  49.         bg.0=Button("openall","Open _all")
  50.         bg.1=Button("closeall","Close a_ll")
  51.         bg.2=Button("openactive","Open a_ctive")
  52.         bg.3=Button("closeactive","Close ac_tive")
  53.  
  54.       mgroup.1="lv"
  55.        lv.Class="NListview"
  56.        lv.List="list"
  57.         list.Class="NListtree"
  58.         list.Frame="InputList"
  59.         list.Format="BAR,"
  60.         list.Title="Name|Phone"
  61.         list.NLTAutoVisible="expand"
  62.         list.DragDropSort=1
  63.  
  64.          list.0="Friends"; list.0.Flags="Close"; list.0.List="fr"
  65.           fr.0="Jhon|555876"; fr.0.name="Jhon"
  66.           fr.1.type="Tree"; fr.1.Flags="Close"; fr.1="Uni|555643"; fr.1.list="uni"
  67.            uni.0="Mary|555987"
  68.            uni.1="Carol|555432"
  69.            uni.2.Flags="list"; uni.2="Frank|555432"
  70.           fr.2="Angel|5554231"
  71.          list.1="St. Clara Comp shop|555543241"
  72.  
  73.       mgroup.2="acg"
  74.        acg.class="group"
  75.        acg.horiz=1
  76.         aname.format="right"
  77.         acg.0=Label(ParseText("%bActiveName:"))
  78.         acg.1=string("aname")
  79.         acg.2=Label(ParseText("%bActiveID:"))
  80.         acg.3="aid"
  81.          aid.class="slider"
  82.          aid.min=0
  83.          aid.max=16
  84.  
  85.       mgroup.3="ddg"
  86.        ddg.class="group"
  87.        ddg.horiz=1
  88.         ddg.0=Label(ParseText("%b D&D here!"))
  89.         ddg.1=text("text")
  90.  
  91.     res = NewObj("APPLICATION","APP")
  92.     if res>0 then exit
  93.  
  94.     call dandd(list,"text")
  95.  
  96.     call Notify("win","closerequest",1,"app","returnid","quit")
  97.  
  98.     call Notify("list","activename","everytime","aname","set","contents","triggervalue")
  99.     call Notify("list","activeid","everytime","aid","set","value","triggervalue")
  100.     call Notify("list","activeid","everytime","app","return","say h.activeid","triggerattr")
  101.  
  102.     call Notify("openall","pressed",0,"list","open","root","all")
  103.     call Notify("openactive","pressed",0,"list","open","active","active")
  104.  
  105.     call Notify("closeall","pressed",0,"list","close","root","all")
  106.     call Notify("closeactive","pressed",0,"list","close","active","active")
  107.  
  108.     call Notify("aname","newcontents","everytime","list","set","activename","triggervalue")
  109.     call Notify("aid","value","everytime","list","set","activeid","triggervalue")
  110.  
  111.     call set("win","open",1)
  112.  
  113.     return
  114. /***********************************************************************/
  115. halt:
  116. break_c:
  117.     exit
  118. /**************************************************************************/
  119. DropFun: procedure
  120. parse arg from,to
  121.     call DoMethod("list","getentry","a","active")
  122.     parse var a name "|" phone
  123.     if phone="" then do
  124.         call DoMethod("win","DisplayBeep")
  125.         return
  126.     end
  127.     c=ParseText("%bName:%n" "%i"name"%n" "%bPhone:%n" "%i"phone"%n")
  128.     call set("text","contents",c)
  129.     return
  130. /**************************************************************************/
  131.  
  132.